package com.frejoys.app.controller;

import com.frejoys.common.aop.Authority;
import com.frejoys.common.aop.Authorization;
import com.frejoys.common.constant.CommonConstant;
import com.frejoys.common.dto.admin.StoreActivityQueueListDto;
import com.frejoys.common.dto.common.IdDto;
import com.frejoys.common.response.Result;
import com.frejoys.common.util.RequestUtil;
import com.frejoys.common.vo.store.StoreActivityQueueInfoVo;
import com.frejoys.common.vo.store.StoreActivityQueueVo;
import com.frejoys.service.StoreActivityQueueService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "店铺活动", description = "店铺活动队列")
@RestController
@RequiredArgsConstructor
@RequestMapping(CommonConstant.routePrefixApp)
@Authorization(Authority.Private)
public class StoreActivityQueueController {

    private final StoreActivityQueueService storeActivityQueueService;

    /**
     * 查询用户参与店铺活动队列
     * @param dto
     * @return
     */
    @PostMapping("/activity/listInfo")
    @Operation(summary = "查询用户参与店铺活动队列")
    public Result<List<StoreActivityQueueVo>> listInfo(@RequestBody @Validated StoreActivityQueueListDto dto) {
        return Result.success(storeActivityQueueService.listInfo(dto, RequestUtil.userId()));
    }

    /**
     * 获取信息
     *
     * @param dto
     * @return
     */
    @PostMapping("/activity/getInfo")
    @Operation(summary = "获取信息")
    public Result<StoreActivityQueueInfoVo> getInfo(@RequestBody @Validated IdDto dto){
        return Result.success(storeActivityQueueService.getInfo(dto));
    }

}
